package com.sc.nft.admin.controller;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sc.nft.admin.request.*;
import com.sc.nft.admin.request.IdRequest;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dao.MallActivityDao;
import com.sc.nft.dao.MallCategoryDao;
import com.sc.nft.dto.*;
import com.sc.nft.entity.MallActivity;
import com.sc.nft.entity.MallCategory;
import com.sc.nft.entity.MallProduct;
import com.sc.nft.entity.dto.MallProductDTO;
import com.sc.nft.entity.vo.*;
import com.sc.nft.entity.vo.mall.AdminSalesPageVO;
import com.sc.nft.entity.vo.mall.MallActivitySalesPriceUpdateVO;
import com.sc.nft.entity.vo.mall.MallActivityStockUpdateVO;
import com.sc.nft.service.MallActivityService;
import com.sc.nft.service.MallCategoryService;
import com.sc.nft.service.MallProductService;
import com.sc.nft.sup.ErrorCode;
import com.sc.nft.sup.PageRequest;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import com.sc.nft.util.QAssert;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/mall/product")
@Api(tags = "商城商品管理")
public class MallProductAdminController {

    private final MallProductService productService;
    private final MallActivityService activityService;
    private final MallActivityDao activityDao;
    private final MallCategoryService mallCategoryService;
    private final MallCategoryDao mallCategoryDao;

    @ApiOperation(value = "商品列表", notes = "商品列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/productPage", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<ProductPageDTO> productPage(@RequestBody ProductListRequest request) {
        IPage<ProductPageDTO> page = productService.getProductPage(request.getCategoryId(), request.getType(), request.getApprovalStatus(), request.getDaoId(), request.getName(), request.toMp(), request.getSupplierId(),request.getSupplierName());
        return PageResult.success(page);
    }

    @ApiOperation(value = "修改商品分类", notes = "修改商品分类", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/updateProductCategory", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result updateProductCategory(@RequestBody EditProductCategoryRequest request) {
        MallProduct mallProduct = productService.getById(request.getId());
        if (ObjectUtil.isNull(mallProduct)) {
            return Result.fail(ErrorCode.PRODUCT_NOT_FOUND);
        }
        MallCategory category = mallCategoryDao.getById(request.getCategoryId());
        if (ObjectUtil.isNull(category)) {
            return Result.fail("分类不存在");
        }
        if (mallProduct.getIsVirtual()){
            if (category.getIsVirtual()){
                mallProduct.setCategoryId(request.getCategoryId());
                mallProduct.updateById();
            }else {
                return Result.fail("虚拟商品无法修改非虚拟分类");
            }
        }else {
            if (!category.getIsVirtual()){
                mallProduct.setCategoryId(request.getCategoryId());
                mallProduct.updateById();
            }else {
                return Result.fail("商品无法修改虚拟分类");
            }
        }
        return Result.success();
    }


    @ApiOperation(value = "查询活动列表", notes = "查询活动列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/queryActivity", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<ActivityPageDTO> queryActivity(@Valid @RequestBody QueryActivityRequest request) {
        return PageResult.success(activityService.queryActivity(request.getDaoId(), request.getStatus(), request.getRecommend(), request.getApprovalStatus(), request.getProductType(), request.getActivityType(), request.getProductName(),request.getShowMiniMall(), request.toMp()));
    }

    @ApiOperation(value = "设置商城排序", notes = "设置商城排序", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setMallSort", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result setMallSort(@Valid @RequestBody SortRequest request) {
        MallActivity mallActivity = activityDao.getById(request.getId());
        if (ObjectUtil.isNull(mallActivity)) {
            return Result.fail("活动不存在");
        }
        mallActivity.setMallSort(request.getSort());
        activityDao.updateById(mallActivity);
        return Result.success();
    }

    @ApiOperation(value = "商品详情", notes = "商品详情", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/detail", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<ProductDetailDTO> detail(@RequestBody IdRequest dto) {
        return Result.success(productService.detail(dto.getId()));
    }

    @ApiOperation(value = "活动详情", notes = "活动详情", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/activityDetail", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<ActivityDTO> activityDetail(@Valid @RequestBody IdRequest request) {
        return Result.success(activityService.detail(request.getId()));
    }

    @ApiOperation(value = "活动审核", notes = "活动审核", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/activityApproval", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result activityApproval(@Valid @RequestBody ApprovalRequest request) {
        activityService.activityApproval(request.getId(), request.getPass(), request.getRemark());
        return Result.success();
    }

    @ApiOperation(value = "规格列表", notes = "规格列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/specsList", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<List<MallProductSpecsDTO>> specsList(@RequestBody IdRequest dto) {
        return Result.success(productService.productSpecsList(dto.getId()));
    }


    @ApiOperation(value = "商品审核", notes = "商品审核", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/approval", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result approval(@RequestBody ApprovalRequest dto) {
        productService.approval(dto.getId(), dto.getPass(), dto.getRemark());
        return Result.success();
    }

    @ApiOperation(value = "是否允许使用购物金", notes = "是否允许使用购物金", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/updateAllowedShoppingCoupons", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<?> updateAllowedShoppingCoupons(@RequestBody AllowedShoppingCouponsRequest dto) {
        productService.allowedShoppingCoupons(dto.getId(), dto.getAllowed());
        return Result.success();
    }

    @ApiOperation(value = "推荐商品列表", notes = "商品列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/recommendPage", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<ProductRecommendDTO> productPage(@RequestBody ProductRecommendListRequest request) {
        IPage<ProductRecommendDTO> page = productService.getProductRecommend(request.getActivityType(), request.getType(), request.getStatus(), request.getDaoId(), request.getName(), request.toMp());
        return PageResult.success(page);
    }

    @ApiOperation(value = "添加推荐商品", notes = "添加推荐商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/addRecommend", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result addRecommend(@RequestBody AddRecommendProductRequest request) {
        productService.addRecommend(request.getActivityId(), request.getRecommendWord());
        return Result.success();
    }

    @ApiOperation(value = "批量添加推荐商品", notes = "批量添加推荐商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/addBatchRecommend", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result addBatchRecommend(@Validated @RequestBody IdsRequest request, BindingResult bindingResult) {
        // 参数校验
        QAssert.validBindResult(bindingResult);
        productService.addBatchRecommend(request.getIds());
        return Result.success();
    }

    @ApiOperation(value = "移除推荐商品", notes = "移除推荐商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/removeRecommend", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result removeRecommend(@RequestBody IdRequest request) {
        productService.removeRecommend(request.getId());
        return Result.success();
    }

    @ApiOperation(value = "设置推荐商品权重", notes = "设置推荐商品权重", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setRecommendSort", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result setRecommendSort(@RequestBody SortRequest request) {
        productService.setRecommendSort(request.getId(), request.getSort());
        return Result.success();
    }

    @ApiOperation(value = "设置推荐商品关键词", notes = "设置推荐商品关键词", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setRecommendWord", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result setRecommendWord(@RequestBody EditRecommendProductRequest request) {
        productService.setRecommendWord(request.getId(), request.getRecommendWord());
        return Result.success();
    }


    @ApiOperation(value = "添加热门商品", notes = "添加热门商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/addHotSaleActivity", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result addHotSaleActivity(@RequestBody AddHotSaleActivityRequest request) {
        productService.addHotSaleActivity(request.getActivityId(), request.getHotSaleImage(), request.getHotSaleTitle(), request.getSort());
        return Result.success();
    }

    @ApiOperation(value = "移除热门商品", notes = "移除热门商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/removeHotSaleActivity", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result removeHotSaleActivity(@RequestBody IdRequest request) {
        productService.removeHotSaleActivity(request.getId());
        return Result.success();
    }

    @ApiOperation(value = "设置热门商品排序", notes = "设置热门商品排序", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setHotSaleSort", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result setHotSaleSort(@RequestBody SortRequest request) {
        productService.setHotSaleSort(request.getId(), request.getSort());
        return Result.success();
    }

    @ApiOperation(value = "设置热门商品上/下架", notes = "设置热门商品上/下架", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setHotSaleStatus", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result setHotSaleStatus(@RequestBody StatusRequest request) {
        productService.setHotSaleStatus(request.getId(), request.getStatus());
        return Result.success();
    }

    @ApiOperation(value = "热门商品列表", notes = "热门商品列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/hotSalePage", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<ProductHotSaleDTO> hotSalePage(@RequestBody ProductRecommendListRequest request) {
        return PageResult.success(productService.hotSalePage(request.getActivityType(), request.getType(), request.getStatus(), request.getDaoId(), request.getName(), request.toMp()));
    }

    @ApiOperation(value = "分类列表", notes = "分类列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/categoryPage", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<MallCategoryVO> categoryPage(@Valid @RequestBody AdminCategoryPage request) {
        return PageResult.success(mallCategoryService.categoryPage(request.getName(), request.getIsVirtual(), request.toMp()));
    }


    @ApiOperation(value = "添加分类", notes = "添加分类", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/addCategory", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result add(@Valid @RequestBody AddCategoryRequest request) {
        mallCategoryService.addCategory(request.getName(), request.getIsBrandUse(), request.getSort(), request.getIsSearchCondition(), request.getIsVirtual());
        return Result.success();
    }

    @ApiOperation(value = "修改分类名称", notes = "修改分类名称", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setCategoryName", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result setCategoryName(@RequestBody SetCategoryNameRequest request) {
        productService.setCategoryName(request.getId(), request.getName());
        return Result.success();
    }

    @ApiOperation(value = "修改分类品牌是否可用", notes = "修改分类品牌是否可用", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setIsBrandUse", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result setIsBrandUse(@RequestBody SetIsBrandUse request) {
        productService.setIsBrandUse(request.getId(), request.getIsBrandUse());
        return Result.success();
    }


    @ApiOperation(value = "修改分类是否展示", notes = "修改分类是否展示", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setIsShow", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result setIsBrandUse(@RequestBody SetIsShowRequest request) {
        productService.setIsShow(request.getId(), request.getIsShow());
        return Result.success();
    }

    @ApiOperation(value = "修改是否是虚拟分类", notes = "修改是否是虚拟分类", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setIsVirtual", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result setIsVirtual(@RequestBody SetIsVirtualRequest request) {
        productService.setIsVirtual(request.getId(), request.getIsVirtual());
        return Result.success();
    }

    @ApiOperation(value = "移除分类", notes = "移除热门商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/removeCategory", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result removeCategory(@RequestBody IdRequest request) {
        productService.removeCategory(request.getId());
        return Result.success();
    }

    @ApiOperation(value = "设置热门商品排序", notes = "设置热门商品排序", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/setCategorySort", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result setCategorySort(@RequestBody SortRequest request) {
        productService.setCategorySort(request.getId(), request.getSort());
        return Result.success();
    }

    @ApiOperation(value = "获取IP商城品牌直销的活动列表", notes = "获取IP商城品牌直销的活动列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/simpleList", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<List<AdminSalesPageVO>> getSalesPage(@RequestBody TitleRequest request) {
        return Result.successColl(productService.simpleList(request.getProductName()), AdminSalesPageVO.class);
    }

    @ApiOperation(value = "获取IP商城品牌直销的活动列表", notes = "获取IP商城品牌直销的活动列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/getSalesPage", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<AdminSalesPageVO> getSalesPage(@RequestBody PageRequest request) {
        return PageResult.success(activityService.getSalesPage(request.toMp()));
    }

    @ApiOperation(value = "获取IP商城商品列表", notes = "获取IP商城品牌直销的活动列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/getProductPage", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<AdminSalesPageVO> getProductPage(@RequestBody PageRequest request) {
        return PageResult.success(activityService.getProductPage(request.toMp()));
    }

    @ApiOperation(value = "批量活动下架", notes = "批量活动下架", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/activity/batchOnShelf", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result batchOffShelf(@Validated @RequestBody IdsRequest idsRequest, BindingResult bindingResult) {
        // 参数校验
        QAssert.validBindResult(bindingResult);
        idsRequest.getIds().forEach(id -> activityService.offShelf(id));
        return Result.success();
    }

    @ApiOperation(value = "活动库存修改", notes = "活动库存修改", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/activity/updateMallActivityStock", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result updateMallActivityStock(@Validated @RequestBody MallActivityStockUpdateVO mallActivityStockUpdateVO, BindingResult bindingResult) {
        // 参数校验
        QAssert.validBindResult(bindingResult);
        activityService.updateMallActivityStock(mallActivityStockUpdateVO);
        return Result.success();
    }

    @ApiOperation(value = "活动商品展示渠道修改", notes = "活动商品活展示渠道修改", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/activity/updateShowChannel", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result updateShowChannel(@Valid @RequestBody MallActivityUpdateShowChannelVO mallActivityUpdateShowChannelVO) {
        activityService.updateShowChannel(mallActivityUpdateShowChannelVO);
        return Result.success();
    }

    @ApiOperation(value = "活动规格售价修改", notes = "活动规格售价修改", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/activity/updateMallActivitySalesPrice", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result updateMallActivitySalesPrice(@Validated @RequestBody MallActivitySalesPriceUpdateVO mallActivitySalesPriceUpdateVO, BindingResult bindingResult) {
        // 参数校验
        QAssert.validBindResult(bindingResult);
        activityService.updateMallActivitySalesPrice(mallActivitySalesPriceUpdateVO);
        return Result.success();
    }

    @ApiOperation(value = "添加商品", notes = "添加商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<MallProductDTO> add(@Valid @RequestBody MallProductVO mallProductVO) {
        MallProduct mallProduct = productService.addPassProduct(mallProductVO);
        MallProductDTO mallProductDTO = MallProductDTO.build(mallProduct);
        return Result.success(mallProductDTO);
    }

    @ApiOperation(value = "编辑商品", notes = "编辑商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/edit", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<MallProductDTO> edit(@Valid @RequestBody MallProductVO mallProductVO) {
        MallProduct mallProduct = productService.editPassProduct(mallProductVO);
        MallProductDTO mallProductDTO = MallProductDTO.build(mallProduct);
        return Result.success(mallProductDTO);
    }

    @ApiOperation(value = "删除商品", notes = "删除商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/del", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result del(@RequestBody IdRequest dto) {
        productService.del(dto.getId());
        return Result.success();
    }

    @ApiOperation(value = "添加规格", notes = "添加规格", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/addSpecs", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result addSpecs(@Valid @RequestBody VirtualMallProductSpecsVO virtualMallProductSpecsVO) {
        productService.addProductSpecs(virtualMallProductSpecsVO);
        return Result.success();
    }

    @ApiOperation(value = "删除规格", notes = "删除规格", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/removeSpecs", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result removeSpecs(@RequestBody ProductIdVO productIdVO) {
        productService.removeProductSpecs(productIdVO.getProductId(), productIdVO.getId());
        return Result.success();
    }

    @ApiOperation(value = "编辑规格", notes = "编辑规格", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/editSpecs", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result editProductSpecs(@RequestBody EditVirtualMallProductSpecsVO editVirtualMallProductSpecsVO) {
        productService.editProductSpecs(editVirtualMallProductSpecsVO.getProductId(), editVirtualMallProductSpecsVO.getSpecsId(),editVirtualMallProductSpecsVO.getSpecsName());
        return Result.success();
    }

    @ApiOperation(value = "查询小程序商品", notes = "查询小程序商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/queryMallMiniActivity", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<MiniMallActivityPageDTO> queryMallMiniActivity(@Valid @RequestBody QueryMiniMallActivityRequest request) {
        return PageResult.success(activityService.queryActivityByMiniMall(request.getDaoId(), request.getStatus(), request.getRecommend(), request.getApprovalStatus(),  request.getProductName(),request.getShowMiniMall(), request.toMp(),request.getProfitTemplateId()));
    }


    @ApiOperation(value = "小程序商品下拉框", notes = "小程序商品下拉框", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/queryMiniMallActivitySelect", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<List<QueryMiniMallActivitySelectDTO>> QueryMiniMallActivitySelect(@Valid @RequestBody QueryMiniMallActivitySelectReq req) {
        return Result.success(activityService.QueryMiniMallActivitySelect(req.getId(),req.getProductName()));
    }


    @ApiOperation(value = "商城标签关联选择活动商品", notes = "商城标签关联选择活动商品", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/queryByMallLabel", produces = MediaType.APPLICATION_JSON_VALUE)
    public PageResult<MallGoodsLabelQueryPageDTO> queryByMallLabel(@Valid @RequestBody QueryMallLabelRequest request) {
        return PageResult.success(activityService.queryByMallLabel(request.getProductName(),request.getCategoryId(),request.getStartTime(),request.getEndTime(),request.toMp()));
    }

}
